// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import Cube, { TabPanels } from 'cube-ui'
import App from './App'
import router from './router'
import 'lib-flexible/flexible'
import wx from 'weixin-js-sdk'

Vue.use(Cube)
Vue.config.productionTip = false
Vue.prototype.wx = wx;
if (localStorage.time) {
  console.log(11111)
  if (Date.now() - localStorage.time >60000) {
    console.log(router)
    router.push({path:'/boundTel'})
    // localStorage.clear()
    console.log(888)
  }
}
// function getAddressURLParam(paramName) {
//   //构造一个含有目标参数的正则表达式的对象
//   let reg = new RegExp("(^|&)" + paramName + "=([^&]*)(&|$)");
//   //匹配目标参数
//   let url = window.location.search.substr(1).match(reg);
//   //返回参数值
//   if (url != null)
//     return unescape(url[2]);
//   return null;
// }
// Vue.prototype.openIds = function () {
//   var test = window.location.href
//   test = decodeURIComponent(test)
//   var openid = getAddressURLParam('wx_openid')
//   var nickname = getAddressURLParam('wx_nickname')
//   var sex = getAddressURLParam('sex')
//   //判断路由是否有wx_openid有就存着
//   if (test.indexOf('wx_openid') != -1) {
//     localStorage.openid = openid;
//     localStorage.nickname = nickname;
//     localStorage.sex = sex;
//     localStorage.time = Date.now();
//     return false;
//   } else {
//     //没有就判断本地是否存有
//     if (localStorage.wx_openid) {
//       return false;
//     } else {
//       //没有就重新授权
//       var test1 = window.location.href
//       var name = encodeURIComponent(test1)
//       //跳转到授权地址
//       test1 = "http://cs.cards.myzx.cn/boundTel"
//     }
//   }
// }


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})
